package org.ioriframework.plugin.maven;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 任务线程池处理类
 * @author iori
 *
 */
public class Executorhandler {

	private static Executorhandler executorhandler;
	
	public static Executorhandler getInstance() {
		if (executorhandler == null) {
			executorhandler = new Executorhandler();
		}
		return executorhandler;
	}
	
	/**
	 * 任务线程池
	 */
	private ExecutorService executor;
	
	private Executorhandler() {
		executor = Executors.newFixedThreadPool(Constants.EXECUTOR_SIZE);
	}
	
	/**
	 * 执行任务
	 * @param paramRunnable
	 */
	public void execute(Runnable paramRunnable) {
		executor.execute(paramRunnable);
	}
}
